/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * articulos_sie_traspaso_requisicion_catalogo.java
 *
 * Created on 4/07/2011, 03:22:24 PM
 */

package sie_invdis;



import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
import java.text.*;
import java.text.ParseException;
/**
 *
 * @author Michelle
 */
public class articulos_sie_traspaso_requisicion_catalogo extends javax.swing.JFrame {

    private javax.swing.table.DefaultTableModel jtable_modelo;
    private JTable jtable_tiendas;

    private int buscamp=1;


    private int control_enter=0,controlcombo=0;
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    //se crea intancia de la clase conexion
       bd_conexion x = new bd_conexion() ;
       //se creaa la variable resultset
       ResultSet rs = null;


    /** Creates new form articulos_sie_traspaso_requisicion_catalogo */
    public articulos_sie_traspaso_requisicion_catalogo() {
         this.iniciar_modelo_de_tabla();
        initComponents();

    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(0).setPreferredWidth(35);//status
    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(1).setPreferredWidth(70);//Folio
    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(2).setPreferredWidth(70);//status
    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(3).setPreferredWidth(30);//doc ant.
    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(4).setPreferredWidth(30);//fecha
    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(5).setPreferredWidth(45);//fecha llega tienda
    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(6).setPreferredWidth(45);//f.recepcion
    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(7).setPreferredWidth(40);//Dias Trans.

    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(9).setPreferredWidth(35);//piezas
    jt_catalogo_requisicion_traspasos.getColumnModel().getColumn(10).setPreferredWidth(80);//Observaciones

    jt_catalogo_requisicion_traspasos.getTableHeader().setBackground(Color.yellow);

    this.buttonGroup1.setSelected(jrbtn_pendienteenviar.getModel(), true);
     this.loadcombo();
     controlcombo=1;
     this.carga_datos(4,"");
    }

private void iniciar_modelo_de_tabla()
    {
        jtable_modelo=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo.addColumn("<html><b>Status</b></html>");
        jtable_modelo.addColumn("<html><b>C.Solicita</b></html>");
        jtable_modelo.addColumn("<html><b>Proveedor</b></html>");
        jtable_modelo.addColumn("<html><b>Folio</b></html>");
        jtable_modelo.addColumn("<html><b>Doc. sig.</b></html>");
        jtable_modelo.addColumn("<html><b>Fecha</b></html>");
        jtable_modelo.addColumn("<html><b>F.Surtido</b></html>");
        jtable_modelo.addColumn("<html><b>F.Recepcion</b></html>");
        jtable_modelo.addColumn("<html><b>Dias Trans.</b></html>");
        jtable_modelo.addColumn("<html><b>Piezas</b></html>");
        jtable_modelo.addColumn("<html><b>Observaciones</b></html>");
   }

void cambiartamanofilas()
 {
     //limpiar la tabla
    int numerofilas=this.jtable_modelo.getRowCount();
             for(int i = 0 ;i < numerofilas; i++)
                {
                     jt_catalogo_requisicion_traspasos.setRowHeight(i, 30);
                }
  }


private void carga_datos(int opbus,String tbusca)
    {
      String fechacat = "",fechallegatienda="",fechaentrega="";
      DecimalFormat miformat = new DecimalFormat("###,###,###,###");
      this.LimpiarJTable();
      Object[] fnewRow = new Object[11];
      String texto="select * from x1distribucion_almacen_traspa_requi_catalogo('"+variables_global.getcliente_tistribucion()+"',"+opbus+",'"+tbusca+"','"+variables_global.getcliente_tistribucion()+"') as (iddocum integer,status smallint,idempleado integer,docsiguiente integer,fechadocto date,fechasurtido date,fechallegotienda date,idcliedistribucion character varying(12),idclientesol character varying(12),obserdocto text,usuario character varying(12),flete numeric,guia character varying(60),fechaenvio date,idalma smallint,canpiezassolicita numeric,canpiezassurtido numeric,importecosto numeric,importeprecio numeric,nombrecliente character varying(60),direcliente character varying(50),nombrecliesol character varying(60),dirclientesol character varying(50),empleadonombre character varying(50),nombrepaterno character varying(50),nombreamaterno character varying(50),describestatus text);";
      System.out.println(texto);
       //invoco al metodo que trae el recordset de datos
        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                 fechallegatienda="";
                 fechaentrega="";
                 fnewRow[0]=rs.getString ("status")+":"+rs.getString ("describestatus");
                 fnewRow[1]=rs.getString ("idclientesol")+":"+rs.getString ("nombrecliesol");
                 fnewRow[2]=rs.getString ("idcliedistribucion")+":"+rs.getString ("nombrecliente");
                 fnewRow[3]=rs.getString ("iddocum");
                 fnewRow[4]=rs.getString ("docsiguiente");
                 fnewRow[5]="<html>"+this.fechaeuropea(rs.getString ("fechadocto"))+":<br>"+DiaSemana(this.fechaeuropea(rs.getString ("fechadocto")))+"</html>";
                 if(rs.getString("fechasurtido") != null)
                        {
                           fechallegatienda="<html>"+ rs.getString("fechasurtido")+":<br>"+DiaSemana(rs.getString ("fechasurtido"))+"</html>";
                        }
                 fnewRow[6]=fechallegatienda;
                 if(rs.getString("fechallegotienda") != null )
                        {
                            fechaentrega="<html>"+rs.getString ("fechallegotienda")+":<br>"+this.DiaSemana(rs.getString("fechallegotienda"))+"</html>";
                        }
                 fnewRow[7]=fechaentrega;
                 fnewRow[8]="";
                 fnewRow[9]=rs.getString("canpiezassolicita");
                 fnewRow[10]=rs.getString ("obserdocto");
                // System.out.println("paso aqui en error 2");
                 jtable_modelo.addRow(fnewRow);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());

        }
      this.cambiartamanofilas();
      this.registrosobtenidos();
}

void registrosobtenidos()
 {
     //limpiar la tabla
    this.jlbl_cantidadregistros.setText(String.valueOf(this.jtable_modelo.getRowCount()));
    this.jlbl_textobuscado.setText(this.jtf_busqueda.getText().toUpperCase().trim());
 }
private String  fechaeuropea(String fecha) {

         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }
     private String DiaSemana(String fe) {
         String dia = "";
       java.util.Date fecha=null;
         try
            {
             fecha = formateador.parse(fe);

           }
        catch (ParseException e)
            {
            //Error, la cadena de texto no se puede convertir en fecha.
            }
        Calendar cal= Calendar.getInstance();
        cal.setTime(fecha);
        //ojo para establecer o recetear cada parte de la fecha por separado
        //cal.set(Calendar.YEAR, fecha.getYear());
        //cal.set(Calendar.MONTH, fecha.getMonth());
        //cal.set(Calendar.DAY_OF_MONTH, fecha.getDay());
        int diaInt = cal.get(Calendar.DAY_OF_WEEK);
        switch (diaInt) {
            case 1:
                dia = "Domingo";
                break;
            case 2:
                dia = "Lunes";
                break;
            case 3:
                dia = "Martes";
                break;
            case 4:
                dia = "Miercoles";
                break;
            case 5:
                dia = "Jueves";
                break;
            case 6:
                dia = "Viernes";
                break;
            case 7:
                dia = "Sabado";
                break;

        }
        return dia;
    }

private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        int fila = jt_catalogo_requisicion_traspasos.getSelectedRow();
        //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
        articulos_sie_traspaso_requisicion_detalle fastrd=new articulos_sie_traspaso_requisicion_detalle(jt_catalogo_requisicion_traspasos.getValueAt(fila, 3).toString());
        fastrd.pack();
        fastrd.setVisible(true);
    }


private void loadcombo(){
    jtable_tiendas=variables_global.gettabla_tiendas();
    int numerotiendas=this.jtable_tiendas.getRowCount();
    this.jcbx_tiendas.addItem("0:Elija Una Tienda");
    for(int ii=0;ii<numerotiendas;ii++)
        {
            this.jcbx_tiendas.addItem(jtable_tiendas.getValueAt(ii, 1)+":"+jtable_tiendas.getValueAt(ii, 0));
        }
    }
void LimpiarJTable()
 {
     //limpiar la tabla
    while(jt_catalogo_requisicion_traspasos.getRowCount()>0)jtable_modelo.removeRow(0);
 }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt_catalogo_requisicion_traspasos = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        };
        ;
        jLabel5 = new javax.swing.JLabel();
        jlbl_textobuscado = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jlbl_cantidadregistros = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jbtn_salir = new javax.swing.JButton();
        jbtn_addrequisiciontrapa = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jcbx_tiendas = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jtf_busqueda = new javax.swing.JTextField();
        jbtn_busqueda = new javax.swing.JButton();
        jrbtn_folio = new javax.swing.JRadioButton();
        jrbtn_pendienteenviar = new javax.swing.JRadioButton();
        jrbtn_enproceso = new javax.swing.JRadioButton();
        jrbtn_general = new javax.swing.JRadioButton();
        jrbtn_recepcionados = new javax.swing.JRadioButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jmni_escape = new javax.swing.JMenuItem();
        jmni_actualizar = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(articulos_sie_traspaso_requisicion_catalogo.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel4.border.title"))); // NOI18N
        jPanel4.setName("jPanel4"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jt_catalogo_requisicion_traspasos.setModel(this.jtable_modelo);
        jt_catalogo_requisicion_traspasos.setName("jt_catalogo_requisicion_traspasos"); // NOI18N
        jt_catalogo_requisicion_traspasos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_catalogo_requisicion_traspasosMouseClicked(evt);
                if(evt.getClickCount() >= 2)
                {
                    dioclick(evt);
                    //System.out.println(" double click" );
                }
            }
        });
        jt_catalogo_requisicion_traspasos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_catalogo_requisicion_traspasosMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jt_catalogo_requisicion_traspasos);

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jlbl_textobuscado.setFont(resourceMap.getFont("jlbl_textobuscado.font")); // NOI18N
        jlbl_textobuscado.setText(resourceMap.getString("jlbl_textobuscado.text")); // NOI18N
        jlbl_textobuscado.setName("jlbl_textobuscado"); // NOI18N

        jLabel3.setFont(resourceMap.getFont("jLabel3.font")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jlbl_cantidadregistros.setFont(resourceMap.getFont("jlbl_cantidadregistros.font")); // NOI18N
        jlbl_cantidadregistros.setText(resourceMap.getString("jlbl_cantidadregistros.text")); // NOI18N
        jlbl_cantidadregistros.setName("jlbl_cantidadregistros"); // NOI18N

        jLabel6.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jlbl_textobuscado, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addComponent(jlbl_cantidadregistros, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel6)
                .addContainerGap())
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 872, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jlbl_cantidadregistros)
                    .addComponent(jLabel3)
                    .addComponent(jLabel5)
                    .addComponent(jlbl_textobuscado))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel3.setName("jPanel3"); // NOI18N

        jbtn_salir.setText(resourceMap.getString("jbtn_salir.text")); // NOI18N
        jbtn_salir.setName("jbtn_salir"); // NOI18N
        jbtn_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_salirActionPerformed(evt);
            }
        });

        jbtn_addrequisiciontrapa.setIcon(resourceMap.getIcon("jbtn_addrequisiciontrapa.icon")); // NOI18N
        jbtn_addrequisiciontrapa.setText(resourceMap.getString("jbtn_addrequisiciontrapa.text")); // NOI18N
        jbtn_addrequisiciontrapa.setToolTipText(resourceMap.getString("jbtn_addrequisiciontrapa.toolTipText")); // NOI18N
        jbtn_addrequisiciontrapa.setName("jbtn_addrequisiciontrapa"); // NOI18N
        jbtn_addrequisiciontrapa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_addrequisiciontrapaActionPerformed(evt);
            }
        });

        jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setToolTipText(resourceMap.getString("jButton1.toolTipText")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addComponent(jbtn_addrequisiciontrapa)
                .addGap(18, 18, 18)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 533, Short.MAX_VALUE)
                .addComponent(jbtn_salir))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtn_salir)
                    .addComponent(jbtn_addrequisiciontrapa)
                    .addComponent(jButton1))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        jcbx_tiendas.setToolTipText(resourceMap.getString("jcbx_tiendas.toolTipText")); // NOI18N
        jcbx_tiendas.setName("jcbx_tiendas"); // NOI18N
        jcbx_tiendas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_tiendasActionPerformed(evt);
            }
        });

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jtf_busqueda.setToolTipText(resourceMap.getString("jtf_busqueda.toolTipText")); // NOI18N
        jtf_busqueda.setName("jtf_busqueda"); // NOI18N
        jtf_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_busquedaActionPerformed(evt);
            }
        });

        jbtn_busqueda.setIcon(resourceMap.getIcon("jbtn_busqueda.icon")); // NOI18N
        jbtn_busqueda.setText(resourceMap.getString("jbtn_busqueda.text")); // NOI18N
        jbtn_busqueda.setToolTipText(resourceMap.getString("jbtn_busqueda.toolTipText")); // NOI18N
        jbtn_busqueda.setName("jbtn_busqueda"); // NOI18N
        jbtn_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_busquedaActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_folio);
        jrbtn_folio.setText(resourceMap.getString("jrbtn_folio.text")); // NOI18N
        jrbtn_folio.setToolTipText(resourceMap.getString("jrbtn_folio.toolTipText")); // NOI18N
        jrbtn_folio.setActionCommand(resourceMap.getString("jrbtn_folio.actionCommand")); // NOI18N
        jrbtn_folio.setName("jrbtn_folio"); // NOI18N
        jrbtn_folio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_folioActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_pendienteenviar);
        jrbtn_pendienteenviar.setText(resourceMap.getString("jrbtn_pendienteenviar.text")); // NOI18N
        jrbtn_pendienteenviar.setToolTipText(resourceMap.getString("jrbtn_pendienteenviar.toolTipText")); // NOI18N
        jrbtn_pendienteenviar.setActionCommand(resourceMap.getString("jrbtn_pendienteenviar.actionCommand")); // NOI18N
        jrbtn_pendienteenviar.setName("jrbtn_pendienteenviar"); // NOI18N
        jrbtn_pendienteenviar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_pendienteenviarActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_enproceso);
        jrbtn_enproceso.setText(resourceMap.getString("jrbtn_enproceso.text")); // NOI18N
        jrbtn_enproceso.setActionCommand(resourceMap.getString("jrbtn_enproceso.actionCommand")); // NOI18N
        jrbtn_enproceso.setName("jrbtn_enproceso"); // NOI18N
        jrbtn_enproceso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_enprocesoActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_general);
        jrbtn_general.setText(resourceMap.getString("jrbtn_general.text")); // NOI18N
        jrbtn_general.setActionCommand(resourceMap.getString("jrbtn_general.actionCommand")); // NOI18N
        jrbtn_general.setName("jrbtn_general"); // NOI18N
        jrbtn_general.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_generalActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_recepcionados);
        jrbtn_recepcionados.setText(resourceMap.getString("jrbtn_recepcionados.text")); // NOI18N
        jrbtn_recepcionados.setActionCommand(resourceMap.getString("jrbtn_recepcionados.actionCommand")); // NOI18N
        jrbtn_recepcionados.setName("jrbtn_recepcionados"); // NOI18N
        jrbtn_recepcionados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_recepcionadosActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap(217, Short.MAX_VALUE)
                        .addComponent(jrbtn_folio, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_enproceso)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_pendienteenviar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_recepcionados)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_general)
                        .addGap(192, 192, 192))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addGap(255, 255, 255)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtn_busqueda)
                        .addGap(17, 17, 17)
                        .addComponent(jLabel4)
                        .addGap(14, 14, 14)
                        .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(70, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(jbtn_busqueda)
                    .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jrbtn_folio, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_enproceso)
                    .addComponent(jrbtn_pendienteenviar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_recepcionados)
                    .addComponent(jrbtn_general)))
        );

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
        jmni_escape.setName("jmni_escape"); // NOI18N
        jmni_escape.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_escapeActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_escape);

        jmni_actualizar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        jmni_actualizar.setIcon(resourceMap.getIcon("jmni_actualizar.icon")); // NOI18N
        jmni_actualizar.setText(resourceMap.getString("jmni_actualizar.text")); // NOI18N
        jmni_actualizar.setName("jmni_actualizar"); // NOI18N
        jmni_actualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_actualizarActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_actualizar);

        jMenuBar1.add(jMenu2);

        jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N
        jMenu3.setName("jMenu3"); // NOI18N
        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10, 10, 10))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(491, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(124, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
       if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0) {
             this.dispose();
        }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jt_catalogo_requisicion_traspasosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_catalogo_requisicion_traspasosMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jt_catalogo_requisicion_traspasosMouseClicked

    private void jbtn_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_salirActionPerformed
        // TODO add your handling code here:
        // x.cierraConexion();   // TODO add your handling code here:
        this.dispose();
}//GEN-LAST:event_jbtn_salirActionPerformed

    private void jcbx_tiendasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_tiendasActionPerformed
        // TODO add your handling code here:
        if (controlcombo > 0 ) {
            if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0) {
                String arreglo_idtie[]=null;
                arreglo_idtie=this.jcbx_tiendas.getSelectedItem().toString().split(":");
                this.jtf_busqueda.setText(arreglo_idtie[0]);
                buscamp=5;
                this.buttonGroup1.setSelected(jrbtn_pendienteenviar.getModel(), true);
                this.carga_datos(buscamp,this.jtf_busqueda.getText().toUpperCase());
                //  this.carga_datos(fidtienda);
            }
        }
        //this.jtfpruebados.setText(jtable_tiendas.getValueAt(indeceta, 0).toString());
}//GEN-LAST:event_jcbx_tiendasActionPerformed

    private void jtf_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_busquedaActionPerformed
        // TODO add your handling code here:
        this.jbtn_busquedaActionPerformed(evt);
}//GEN-LAST:event_jtf_busquedaActionPerformed

    private void jbtn_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_busquedaActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Estan correcto sus Datos?")==0) {
            this.carga_datos(buscamp,this.jtf_busqueda.getText().toUpperCase());
            //  this.cambiartamanofilas();
        }
}//GEN-LAST:event_jbtn_busquedaActionPerformed

    private void jrbtn_folioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_folioActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_folioActionPerformed

    private void jrbtn_pendienteenviarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_pendienteenviarActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_pendienteenviarActionPerformed

    private void jrbtn_enprocesoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_enprocesoActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_enprocesoActionPerformed

    private void jrbtn_generalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_generalActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_generalActionPerformed

    private void jrbtn_recepcionadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_recepcionadosActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_recepcionadosActionPerformed

    private void jbtn_addrequisiciontrapaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_addrequisiciontrapaActionPerformed
        // TODO add your handling code here:
        articulos_sie_traspaso_requisicion astr=new articulos_sie_traspaso_requisicion();
        astr.pack();
        astr.setVisible(true);        // TODO add your handling code here:
    }//GEN-LAST:event_jbtn_addrequisiciontrapaActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        com_distri_articulos_almacen_resurtir  fcdaar = new com_distri_articulos_almacen_resurtir();
        fcdaar.pack();
        fcdaar.setVisible(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jmni_actualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_actualizarActionPerformed
        // TODO add your handling code here:
       if(JOptionPane.showConfirmDialog(null, "Desea Actualizar?")==0) {
           this.carga_datos(0,"");
       }

    }//GEN-LAST:event_jmni_actualizarActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new articulos_sie_traspaso_requisicion_catalogo().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbtn_addrequisiciontrapa;
    private javax.swing.JButton jbtn_busqueda;
    private javax.swing.JButton jbtn_salir;
    private javax.swing.JComboBox jcbx_tiendas;
    private javax.swing.JLabel jlbl_cantidadregistros;
    private javax.swing.JLabel jlbl_textobuscado;
    private javax.swing.JMenuItem jmni_actualizar;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JRadioButton jrbtn_enproceso;
    private javax.swing.JRadioButton jrbtn_folio;
    private javax.swing.JRadioButton jrbtn_general;
    private javax.swing.JRadioButton jrbtn_pendienteenviar;
    private javax.swing.JRadioButton jrbtn_recepcionados;
    private javax.swing.JTable jt_catalogo_requisicion_traspasos;
    private javax.swing.JTextField jtf_busqueda;
    // End of variables declaration//GEN-END:variables

}
